package com.zjr.service.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.zjr.dao.LogDao;
import com.zjr.dao.UserDao;
import com.zjr.domain.Log;
import com.zjr.domain.User;
import com.zjr.service.LogService;
import com.zjr.utils.ViewUser;
/**
 * 日志业务层实现类
 * */
@Transactional
public class LogServiceImpl implements LogService {
	private LogDao logDao;
	public void setLogDao(LogDao logDao) {
		this.logDao = logDao;
	}
	
	private UserDao userDao;
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	
	//添加日志实现方法
	@Override
	public boolean save(Log log) {
		System.out.println(log.getUid());
		return logDao.save(log);
	}
	@Override
	public List<Log> find(ViewUser vu) {
		User user = userDao.findByUsername(vu.getUsername());
		return (List<Log>) logDao.find(user);
	}
	@Override
	public Log findById(int lid) {
		return logDao.findById(lid);
	}
	@Override
	public void modify(Log log) {
		logDao.modify(log);
	}
	@Override
	public void delete(int lid) {
		logDao.delete(lid);
	}
}
